### Script 1. Sets Path for Working Directory, loads libraries used in all subsequent scripts
### Creates Figure 1 in text
### Latest Version: 6 September 2018

rm(list=ls())

#Load all libraries required for all scripts in replication analysis

library(dplyr)
library(plyr)
library(agrmt)
library(multilevel)
library(stringr)
library(miscTools)
library(RColorBrewer)
library(reshape2)
library(lattice)
library(Zelig)
library(foreign)
library(grDevices)
library(Amelia)
library(matrixStats)
library(plm)
library(lmtest)

# Load Chapel Hill Data
load("CHESData_clean.Rdata")

# EU POSITION

pdf("chesexamples_euposition.pdf",height=6,width=12)
par(mfrow=c(1,2))

hist(dta2010$position[dta2010$party_id== 1003],xlim=c(0,10),col="deepskyblue3",main="VVD (Netherlands)",xlab="EU Position Expert Placements")
abline(v=mean(dta2010$position[dta2010$party_id== 1003],na.rm=T),lwd=3)

hist(dta2010$position[dta2010$party_id== 1401],xlim=c(0,10),col="deepskyblue3",main="Social Democratic Party (Finland)",xlab="EU Position Expert Placements")
abline(v=mean(dta2010$position[dta2010$party_id== 1401],na.rm=T),lwd=3)

dev.off()


# LEFT RIGHT ECON

pdf("chesexamples_leftrightecon.pdf",height=6,width=12)
par(mfrow=c(1,2))

hist(dta2010$lrecon[dta2010$party_id== 610],xlim=c(0,10),col="deepskyblue3",main="Front National (France)",xlab="LR Econ Expert Placements")
abline(v=mean(dta2010$lrecon[dta2010$party_id==610],na.rm=T),lwd=3)

hist(dta2010$lrecon[dta2010$party_id== 2603],xlim=c(0,10),col="deepskyblue3",main="Civic Platform (Poland)",xlab="LR Eon Expert Placements")

abline(v=mean(dta2010$lrecon[dta2010$party_id== 2603],na.rm=T),lwd=3)
dev.off()



